package com.qingcloud.common.auth.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("oauth_client_details")
public class Client {
   private static final long serialVersionUID = -8185413579135897885L;
   @TableId
   private Long id;

   @ApiModelProperty(value = "应用标识")
   private String clientId;

   @ApiModelProperty(value = "应用名称")
   private String clientName;

   @ApiModelProperty(value = "资源限定串(逗号分割)")
   private String resourceIds = "";

   @ApiModelProperty(value = "应用密钥(bcyt) 加密",hidden = true)
   private String clientSecret;

   @ApiModelProperty(value = "应用密钥(明文)")
   private String clientSecretStr;

   @ApiModelProperty(value = "范围")
   private String scope = "all";

   @ApiModelProperty(value = "5种oauth授权方式(authorization_code,password,refresh_token,client_credentials)")
   private String authorizedGrantTypes = "authorization_code,password,refresh_token,client_credentials";

   @ApiModelProperty(value = "回调地址 ")
   private String webServerRedirectUri;

   @ApiModelProperty(value = "权限 ")
   private String authorities = "";

   @ApiModelProperty(value = "access_token有效期")
   @TableField(value = "access_token_validity")
   private Integer accessTokenValiditySeconds = 18000;

   @ApiModelProperty(value = "refresh_token有效期")
   @TableField(value = "refresh_token_validity")
   private Integer refreshTokenValiditySeconds = 28800;


   private String additionalInformation = "{}";

   @ApiModelProperty(value = "是否自动授权 是-true")
   private String autoapprove = "true";

   @ApiModelProperty(value = "是否支持id_token")
   private Boolean supportIdToken = true;

   @ApiModelProperty(value = "id_token有效期")
   @TableField(value = "id_token_validity")
   private Integer idTokenValiditySeconds = 60;

   @ApiModelProperty(value = "创建时间",hidden = true)
   private String createTime;

   @ApiModelProperty(value = "修改时间",hidden = true)
   private String updateTime;
}
